package pl.edu.agh.sius.gui.model;

import java.util.ArrayList;
import java.util.List;

import pl.edu.agh.sius.ldap.Ldap;

public class ServersTableModel extends TableModel {
	private static final long serialVersionUID = -1653548400329661098L;
	
	private Ldap ldap;
	
	public ServersTableModel() {
		super(new ArrayList<Object>());
		columns.add("Server");
	}
	
	@SuppressWarnings("unchecked")
	public ServersTableModel(List<String> data) {
		super((List<Object>)(List<?>)data);
		columns.add("Server");
	}

	public Object getValueAt(int row, int col) {
		return ((String)dataList.get(row));
	}
	
	@SuppressWarnings("unchecked")
	public void refreshServersList() {
		List<String> servers = ldap.getServersList();
		setData((List<Object>)(List<?>)servers);
	}

	public Ldap getLdap() {
		return ldap;
	}

	public void setLdap(Ldap ldap) {
		this.ldap = ldap;
	}
}